//
//  IManager+ModuleMemberCard.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-16.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleMemberCard.h"
#import "FrameworkRelativeDefines.h"
#import "RequestUtlity.h"
#import "RCCardTypeInfoDataModel.h"
#import "NSString+NSString_Ex_.h"
#import "RCBaseServerDataModel.h"
#import "GloableEngineService.h"

@implementation IManager (ModuleMemberCard)
-(int64_t)requestMerchantCardTypeInfo:(NSString *)cityID WithDelegte:(id<IManagerDelegate>)delegate
{
    if (nil == cityID) {
        return kInvalidRequestId;
    }
    NSString *urlSuffix = [NSString stringWithFormat:kRCMemberCardInfo,cityID];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    
//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"CardTypeJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    
    
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCCardTypeInfoDataModel class]
                                                     withDataDelegate:delegate];
}

- (int64_t) requestApplyforCard:(NSString *)bduss withCardID:(NSInteger)cardId WithDelegte:(id<IManagerDelegate>)delegate
{
    if ([NSString stringIsNullOrEmpty:bduss] || cardId == 0) {
        return kInvalidRequestId;
    }
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCApplyCardPrefix,bduss,cardId];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBaseServerDataModel class]
                                                     withDataDelegate:delegate];
}




- (int64_t) requestStaff:(NSString *)staffID WithDelegte:(id<IManagerDelegate>)delegate
{
    
    NSString *bduss = [[GloableEngineService sharedInstance]  bduss];
    
    if ([NSString stringIsNullOrEmpty:staffID] || [NSString stringIsNullOrEmpty:bduss]) {
        return kInvalidRequestId;
    }
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCStaffPrefix,bduss,staffID];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBaseServerDataModel class]
                                                     withDataDelegate:delegate];
}

@end
